fix: backfill tool call data in chat stream conversion#2306
Open
MiaoZang wants to merge 1 commit into
Open
Conversation
Contributor
|
All contributors have signed the CLA. ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
sakurawztlt
added a commit
to sakurawztlt/sub2api
that referenced
this pull request
May 11, 2026
…m done events Responses → ChatCompletions stream 转换时, tool call 的 name/arguments 不一定在 delta 阶段完整出现, 可能只在 function_call_arguments.done / output_item.done 才补齐. 客户侧之前看到 tool call 缺字段, 后续 tool_result missing 或工具链断裂. 修法: state 加 OutputIndexNameSent / OutputIndexArgsSeen 跟踪每个 tool call 的 name/args 已发情况, 在 *.done 事件时如果还没发就补齐. 只动 OpenAI 兼容层 (Responses ↔ ChatCompletions). Anthropic /v1/messages 路径仍保 toolu_xxx 形态不动, 不影响 cc-api 真 Claude tools. 3 unit test 全过 (Delta / ArgumentsDone / OutputItemDone backfill).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
response.function_call_arguments.doneorresponse.output_item.done.Verification
go test ./internal/pkg/apicompat -run 'TestResponsesEventToChatChunks_ToolCall' -count=1git diff --check